package PlotPourri;

import Jama.Matrix;
import PlotPourri.Database.DatabaseLMCi;
import PlotPourri.Database.StarDatabase;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FourierParameters {

    private int order;
    private BandName bandName;
    static String starDataBase;

    public FourierParameters(int ord, BandName band, String starDB) {
        order = ord;
        bandName = band;
        starDataBase = starDB;
    }

    public String printFourierParameters() {

        //StarDatabase starDatabase = new DatabaseLMCi(new File("C:\\Users\\Chad\\Desktop\\LMC\\TypeI\\OgleIII-F.dat"));
        StarDatabase starDatabase = new DatabaseLMCi(new File(starDataBase));
        Star[] stars = starDatabase.values().toArray(new Star[starDatabase.size()]);
        String outputTotal = "";

        outer:
        for (Star star : stars) {
            String output = star.getPeriod() + "";
            Observation observation = star.getBand(bandName).get(0); //Returns an observation object
            double[] coefficients = observation.getCoefficients(order);

            for (double coefficient : coefficients) {
                if (coefficient == 0) {
                    continue outer;
                }
                output += " " + coefficient;
            }
            outputTotal += output;
            System.out.println(output);
        }
        return outputTotal;
    }
}
